package com.ihr360.authority.sharing.privilege;

import com.ihr360.authority.sharing.service.AuthUserResourceService;
import com.ihr360.commons.model.type.AccessPrivilege;
import com.ihr360.validation.ValidationUtils;

public class DeleteOnePrivilege<ID> extends GetOnePrivilege<ID> {

    public DeleteOnePrivilege(ID id, AuthUserResourceService authUserResourceService,IAccessControlClass iAccessControlClass) {
       super(id,authUserResourceService,iAccessControlClass);
        this.method = AccessControlMethod.METHODS.deleteOne;
        this.iAccessControlClass = iAccessControlClass;
    }

    @Override
    public void validate() {
        if (isAccessControl()) {
            ValidationUtils.rejectIfEmpty(privilege, null, "您没有权限进行此操作");
            ValidationUtils.rejectIfNotEqual(privilege, AccessPrivilege.Privilege.OWNER, null, "您没有权限进行此操作");
        }
    }

}